from django.db import models

class Exam(models.Model):
	name = models.CharField(max_length=64)
	created = models.DateField()
	deadline = models.DateField()
	author = models.CharField(max_length=64)

class ExamQuestion(models.Model):
    question = models.CharField(max_length=64)
    exam = models.ForeignKey(Exam)

class ExamAnswer(models.Model):
    answer = models.CharField(max_length=64)
    question = models.ForeignKey(ExamQuestion)
    correctAnswer = models.IntegerField()

class UserAnswer(models.Model):
    username = models.CharField(max_length=64)
    answer = models.ForeignKey(ExamAnswer)

class Teacher(models.Model):
    username = models.CharField(max_length=64)

class Grades(models.Model):
    username = models.CharField(max_length=64)
    exam = models.ForeignKey(Exam)
    grade = models.FloatField()

class allGrades(models.Model):
    name = models.CharField(max_length=64)
    created = models.DateField()
    deadline = models.DateField()
    author = models.CharField(max_length=64)
    username = models.CharField(max_length=64)
    exam = models.ForeignKey(Exam)
    grade = models.FloatField()
    class Meta:
        db_table = 'exams_allGrades'
        managed = False